home *** CD-ROM | disk | FTP | other *** search
- CSECT InputHandler ;SAS/Lattice ASM command requires this
- *
- INCLUDE "include:exec/types.i"
- INCLUDE "include:exec/io.i"
- INCLUDE "include:devices/inputevent.i"
- *
-
- xdef _ButtonSwap
-
- _ButtonSwap: move.l a0,-(sp) ; Save the event list
- CheckLoop: move.w ie_Qualifier(a0),d1 ; Get qualifiers...
- and.w #$7F,d1 ; clear control
- cmp.w #IEQUALIFIER_LSHIFT,d1 ; is it a shift
- beq NoSaveQual
- cmp.w #IEQUALIFIER_RSHIFT,d1 ; is it right shift
- beq NoSaveQual
- cmp.w #IEQUALIFIER_CONTROL,d1 ; control button
- beq NoSaveQual
- SaveQual: move.w #0,ie_Qualifier(a0) ; Save back...
- NoSaveQual: NOP
- *
- * The actual button up/down events are transmitted as the
- * code field in RAWMOUSE events. The code field must the be
- * checked and modified when needed on RAWMOUSE events. If the
- * event is not a RAWMOUSE, we are done with it.
- *
- move.w ie_Code(a0),d0 ; Get code...
- move.w d0,d1 ; Save...
- and.w #$7F,d0 ; Mask UP_PREFIX
- cmp.w #IECODE_LBUTTON,d0 ; Check for Left...
- beq.s SwapThem ; If so, swap...
- bra.s NextEvent ; If not, next...
- *
- SwapThem: eor.w #1,d1 ; Flip bottom bit
- move.w d1,ie_Code(a0) ; Save it...
-
- *
- * The event list is linked via a pointer to the next event
- * in the first element of the structure. That is why it is not
- * nessesary to use: move.l ie_NextEvent(a0),d0
- *
- * The reason I move to d0 first is that this also checks for zero.
- * The last event in the list will have a NULL ie_NextEvent field.
- * This is NOT as standard EXEC list where the node after the last
- * node is NULL. Input events are single-linked for performance.
- *
- NextEvent: move.l (a0),d0 ; Get next event
- move.l d0,a0 ; into a0...
- bne.s CheckLoop ; Do some more.
- *
- * All done, just return the event list... (in d0)
- *
- move.l (sp)+,d0 ; Get event list back...
- rts ; return from handler...
- *
- END
-